package com.hstcs.game;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.hstcs.assets.Config;
import com.hstcs.screen.SplashScreen;
import com.hstcs.update.CodeLoader;

public class XGame extends Game {


	public static XGame instance = null;
	public static XGame getInstance()
	{
		if(instance == null){
			new XGame();
		}
		return instance;
	}
	
	public XGame()
	{
		instance = this;
	//	Config.set_1280_720();
	}
		

	public Stage stage;
	
	public CodeLoader loader;
	@Override
	public void create() {
		// TODO Auto-generated method stub
		//Config.set_1280_720();
		stage = new Stage();
		stage.setViewport(new StretchViewport(Config._WIDTH,Config._HEIGHT));
		super.setScreen(new SplashScreen());
	}
	
	@Override
	public void render() {
		Gdx.gl.glClearColor(0, 0, 0, 0);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);		
		super.render();
	}
	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		super.resize(width, height);
		stage.getViewport().update(width, height, true);
	}
}
